package com.government.system.service.impl;

import java.util.List;
import org.springframework.transaction.annotation.Transactional;
import com.government.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.government.system.mapper.BannerMapper;
import com.government.system.domain.Banner;
import com.government.system.service.IBannerService;

/**
 * 轮播广告Service业务层处理
 * 
 * @author system
 * @date 2023-11-17
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class BannerServiceImpl implements IBannerService 
{
    @Autowired
    private BannerMapper bannerMapper;

    /**
     * 查询轮播广告
     * 
     * @param id 轮播广告主键
     * @return 轮播广告
     */
    @Override
    public Banner selectBannerById(Long id)
    {
        return bannerMapper.selectById(id);
    }

    /**
     * 查询轮播广告列表
     * 
     * @param banner 轮播广告
     * @return 轮播广告
     */
    @Override
    public List<Banner> selectBannerList(Banner banner)
    {
        return bannerMapper.selectBannerList(banner);
    }

    /**
     * 新增轮播广告
     * 
     * @param banner 轮播广告
     * @return 结果
     */
    @Override
    public int insertBanner(Banner banner)
    {
        banner.setCreateTime(DateUtils.getNowDate());
        return bannerMapper.insert(banner);
    }

    /**
     * 修改轮播广告
     * 
     * @param banner 轮播广告
     * @return 结果
     */
    @Override
    public int updateBanner(Banner banner)
    {
        banner.setUpdateTime(DateUtils.getNowDate());
        return bannerMapper.updateById(banner);
    }

    /**
     * 删除轮播广告信息
     * 
     * @param id 轮播广告主键
     * @return 结果
     */
    @Override
    public int deleteBannerById(Long id)
    {
        return bannerMapper.deleteById(id);
    }
}
